import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
//import { filterDictTextByCache } from '/@/utils/dict/JDictSelectUtil';
//import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
// import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '姓名',
    align: 'left',
    dataIndex: 'xm',
    width: 120,
    // resizable: true,
  },
  {
    title: '身份证号',
    align: 'left',
    dataIndex: 'zjhm',
    width: 180,
    //resizable: true,
  },
  {
    title: '联系电话',
    align: 'left',
    dataIndex: 'lxdh',
    // resizable: true,
  },
  {
    title: '性别',
    align: 'left',
    dataIndex: 'xb_dictText',
    width: 80,
    // resizable: true,
  },
  {
    title: '出生年月',
    align: 'left',
    dataIndex: 'csrq',
    // resizable: true,
  },
  // {
  //   title: '籍贯',
  //   align: 'left',
  //   dataIndex: 'jg',
  //   width: 200,
  //   // resizable: true,
  // },
  {
    title: '入住状态',
    align: 'left',
    dataIndex: 'zkzt',
    customRender: ({ text }) => {
      const color = text == '1' ? 'green' : 'red';
      return render.renderTag(render.renderDict(text, 'zkzt'), color);
    },
    // resizable: true,
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    field: 'xm',
    label: '住客姓名',
    component: 'Input',
    //defaultValue: ['130000', '130200'],
  },
  // {
  //   label: '房源编号',
  //   field: 'wyfbh',
  //   component: 'Input', //渲染的组件
  //   componentProps: {
  //     //  dictCode: 'status',
  //   },
  // },
  {
    label: '身份证',
    field: 'zjhm',
    component: 'Input', //渲染的组件
  },
  {
    label: '入住状态',
    field: 'zkzt',
    component: 'JDictSelectTag', //渲染的组件
    //defaultValue: '', //设置默认值
    componentProps: {
      dictCode: 'zkzt',
    },
  },
  {
    label: '性别',
    field: 'xb',
    component: 'JDictSelectTag', //渲染的组件
    //defaultValue: '', //设置默认值
    componentProps: {
      dictCode: 'xb',
    },
  },
];

export const detailSchema = [
  {
    field: '基本信息',
    component: 'Input',
    label: '',
    slot: 'title1',
  },
  {
    field: 'xm',
    component: 'Input',
    label: '姓名',
  },
  {
    label: '身份证号',
    field: 'zjhm',
    component: 'Input',
  },
  {
    label: '性别',
    field: 'xb_dictText',
    component: 'Input',
  },
  // {
  //   label: '籍贯',
  //   field: 'jg',
  //   component: 'Input',
  // },

  {
    field: 'csrq',
    component: 'Input',
    label: '出生年月',
  },
  {
    label: '入住状态',
    field: 'zkzt_dictText',
    component: 'Input',
    color: (text) => {
      return text == '入住中' ? 'text-green' : 'text-red';
    },
  },
  {
    label: '照片',
    field: 'headPortraitUrl',
    component: 'JImageUpload',
    componentProps: {
      // fileMax: 3,
    },
  },
  {
    field: '入住记录',
    component: 'Input',
    label: '',
    slot: 'title5',
  },
];
//入住列表数据
export const historyColumns: BasicColumn[] = [
  {
    title: '数据来源',
    align: 'left',
    dataIndex: 'sjly_dictText',
    width: 120,
    // resizable: true,
  },
  {
    title: '所属区域',
    align: 'left',
    dataIndex: 'xzxq',
    width: 160,
    //resizable: true,
  },
  {
    title: '详细地址',
    align: 'left',
    dataIndex: 'fwdz',
    width: 200,
    // resizable: true,
  },
  {
    title: '房源名称',
    align: 'left',
    dataIndex: 'fh',
    // resizable: true,
  },
  {
    title: '实际居住时间',
    align: 'left',
    dataIndex: 'sjrzsj',
    width: 160,
    customRender: ({ record }) => {
      return (record['sjrzsj'] ?? '') + ' ~ ' + (record['sjldsj'] ?? '');
    },
    // resizable: true,
  },
];
